package com.itheima.health.quartz;

import com.itheima.health.service.OrderSettingService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

@SuppressWarnings("ALL")
/**
 * @Description :
 * @author     :LD
 */
@Component
public class StartOfDayJob extends QuartzJobBean {
    private OrderSettingService orderSettingService;

    @Autowired
    public StartOfDayJob(OrderSettingService orderSettingService) {
        this.orderSettingService = orderSettingService;
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext)
            throws JobExecutionException {
        // 任务的具体逻辑
//        System.out.println(orderSettingService);
        orderSettingService.deleteExpiredOrders();
    }
}
